]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
windowManager: Expose WorkspaceTracker blockUpdates & unblockUpdates
authorTony Chen <contact@tycchen.com>
Tue, 2 Jun 2026 20:16:49 +0000 (16:16 -0400)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 29 Jun 2026 17:47:14 +0000 (19:47 +0200)
Update blocking is currently only used by the workspace switcher popup,
but the workspace animation needs to do the same.

To prepare for that, expose block workspace updates on WindowManager
to make it available outside the module.

Use a counter to track block/unblock calls and avoid contention over the
_pauseWorkspaceCheck boolean inside WorkspaceTracker.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4014>
(cherry picked from commit 217b1502057a78b13a3a5dd73a8b202e81aec127)

js/ui/windowManager.js

index 92d6cf8aa1413bf314b7334e2458fcabe0bea705..fe824a1edbe6f32b1e4bde0568111165db85f1fb 100644 (file)
@@ -512,6 +512,7 @@ export class WindowManager {
 
         this._isWorkspacePrepended = false;
         this._canScroll = true; // limiting scrolling speed
+        this._blockCount = 0;
 
         this._shellwm.connect('kill-window-effects', (shellwm, actor) => {
             this._minimizeWindowDone(shellwm, actor);
@@ -1066,6 +1067,33 @@ export class WindowManager {
         this._workspaceTracker.keepWorkspaceAlive(workspace, duration);
     }
 
+    blockWorkspaceUpdates() {
+        if (++this._blockCount > 1)
+            return;
+
+        if (!this._workspaceTracker)
+            return;
+
+        this._workspaceTracker.blockUpdates();
+    }
+
+    unblockWorkspaceUpdates() {
+        console.assert(this._blockCount > 0,
+            'Unmatched call to unblockWorkspaceUpdates()');
+        if (this._blockCount === 0)
+            return;
+
+        this._blockCount -= 1;
+
+        if (this._blockCount !== 0)
+            return;
+
+        if (!this._workspaceTracker)
+            return;
+
+        this._workspaceTracker.unblockUpdates();
+    }
+
     skipNextEffect(actor) {
         this._skippedActors.add(actor);
     }
@@ -1807,10 +1835,10 @@ export class WindowManager {
 
         if (!Main.overview.visible) {
             if (this._workspaceSwitcherPopup == null) {
-                this._workspaceTracker.blockUpdates();
+                this.blockWorkspaceUpdates();
                 this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
                 this._workspaceSwitcherPopup.connect('destroy', () => {
-                    this._workspaceTracker.unblockUpdates();
+                    this.unblockWorkspaceUpdates();
                     this._workspaceSwitcherPopup = null;
                     this._isWorkspacePrepended = false;
                 });